package com.telnetnz.ticketdesk.bean;

import java.util.List;
import java.util.Map;

import com.telnetnz.ticketdesk.bean.misc.ComparableObject;
import com.telnetnz.ticketdesk.bean.misc.OperationLogObject;
import com.telnetnz.ticketdesk.dao.entity.TagEntity;
import com.telnetnz.ticketdesk.service.OperationLogService;

public class Tag extends TagEntity implements OperationLogObject,
		ComparableObject {

	private static final long serialVersionUID = -7161151140740193930L;

	public List<OperationLog> getOperationLogs()
	{
		return OperationLogService.getLogsByPageAndCondition(
				0, 
				10, 
				OperationLogService.ORDERBY_TIME, 
				0, 
				0L, 		// userId
				OperationLogService.OBJECT_TYPE_TAG, // objectType
				getId(), 
				null, 
				null, 
				null);
	}

	public static Tag adapt(TagEntity entity) {
		if (entity == null)
			return null;
		Tag bean = new Tag();
		bean.setId(entity.getId());
		bean.setName(entity.getName());
		return bean;
	}

	public TagEntity toEntity() {
		return this;
	}

	public Map<String, List<String>> compare() {
		return null;
	}

	public String getObjectName() {
		return this.getName();
	}

	public String getObjectSummary() {
		return this.getName();
	}
}